!pr2
!bm3
!lm12
!rm75
Using the Shift-Key Mod.................Bob Sander-Cederlof

Have you heard of the "Shift-Key Mod"?  By running a wire from the game connector to the right spot on the keyboard circuit, you can use software to tell whether or not the shift key is pressed.  You can make your Apple keyboard almost normal!

Some word processors come with a convenient device which has a clip on one end of a wire, and a DIP socket-plug on the other.  (I sell such a device for $15 without any software.)   Apples with the piggy-back board below the keyboard can use the clip.  If you don't have that kind of Apple, you need to solder a small wire to the bottom of either shift key, and clip onto that wire.  Of course, you can run the wire all the way to the game connector and avoid the extra expense...I did it that way on my first Apple.

But what about software?  All the mod does is bring the shift key into the game connector as PB2.  You can read it with LDA $C063.  If the value read is $00-7F, the shift key is being pressed; if $80-FF, the shift key is not pressed.  You have to write a special keyboard input subroutine to convert letters to lower case ASCII codes if the shift key is not down.

Here is just such a subroutine!  It is the one I use in my word processor (a product still being developed).  Another routine sets up a cursor on the screen, and then calls READ.KEY.WITH.CASE to get the next keypress.

Lines 1140-1160 read the keyboard, and keep reading until you press a key other than the shift key.  Once you press a key, the value at KEYBRD will be a code between $80 and $DF; the value is considered negative by the 6502, so execution continues at line 1170.

Lines 1170-1200 are an optional keyclick routine.  In my word processor, a control-P turns the keyclicking on and off.  I discovered that a very short "bell" sounds like a clicking keyboard, so that is what I use.  The monitor bell subroutine toggles the speaker 192 times at about a 1000 Hertz rate to make a beep; I do it 10 times to make a click.

Lines 1210-1220 pick up the keypress code again and clear the keyboard strobe.  This sets up the keyboard electronics so that you can read the next keypress next time around.

Lines 1230-1240 test the shift key.  If it is down, the BPL will branch to the upper case section at line 1320.  If the shift key is not down, lines 1270-1280 test whether the character is a letter.  If so, line 1290 makes it into a lower-case code.

I am using the codes from $E0 through $FF for lower-case.  This is standard ASCII, and is also compatible with the various lower-case display adapters available on the Apple.  $E1 through $FA are the letters a-z; $E0 is a tick-mark; $FB-FF are special punctuation marks.  If you don't have a lower-case display adapter, these codes display as punctuation and numbers.

Lines 1320-1420 handle characters typed with the shift key down.  If the code is less than $C0, the keyboard input code is correct already.  Above $C0, the code is correct unless you have typed M, N, or P.   The Apple translates these shifted letters into @, ], and ^, respectively.  My logic translates them back into capital letters.

I use a special control sequence to enter the punctuation characters with codes above $C0, which is not shown here.  You type control-O, which stands for "override", and then one of the letters klmnop or KLMNOP.  The letter translates into the corresponding punctuation code.  For example, control-O, shift-M is a right bracket (]); control-O, shift-P is an at-sign (@).
